package com.qcby.pushservice.web.controller;

import cn.hutool.core.bean.BeanUtil;
import com.qcby.framework.common.pojo.Result;
import com.qcby.pushservice.base.bo.SendSmsBO;
import com.qcby.pushservice.base.service.ISendService;
import com.qcby.pushservice.web.entity.param.SendSmsParam;
import com.qcby.pushservice.web.entity.vo.SendSmsResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 发送控制器
 *
 * @author cong.zhen
 * @date 2023/05/09
 */
@RestController
@RequestMapping("/open/send")
public class SendController {

    @Resource
    private ISendService sendService;


    @PostMapping("/sms")
    public Result<SendSmsResponse> sendSms(SendSmsParam sendSmsParam){
        SendSmsBO sendSmsBO = BeanUtil.copyProperties(sendSmsParam,SendSmsBO.class);
        SendSmsBO sendSms = sendService.sendSms(sendSmsBO);
        SendSmsResponse sendSmsResponse = BeanUtil.copyProperties(sendSms,SendSmsResponse.class);
        return Result.getSuccessResult(sendSmsResponse);
    }

}
